<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>The Parle\RLexer class</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="parle-lexer.reset.html">« Parle\Lexer::reset</a></li>
      <li style="float: right;"><a href="parle-rlexer.advance.html">Parle\RLexer::advance »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="book.parle.html">Parle</a></li>
    <li>The Parle\RLexer class</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="class.parle-rlexer" class="reference">

 <h1 class="title">The Parle\RLexer class</h1>
 

 <div class="partintro"><p class="verinfo">(PECL parle &gt;= 0.5.1)</p>


  <div class="section" id="parle-rlexer.intro">
   <h2 class="title">简介</h2>
   <p class="para">
    Multistate lexer class. Lexemes can be defined on the fly. If the particular lexer instance is meant to be used with <span class="classname"><a href="class.parle-rparser.html" class="classname">Parle\RParser</a></span>, the token IDs need to be taken from there. Otherwise, arbitrary token IDs can be supplied. Note, that <span class="classname"><a href="class.parle-parser.html" class="classname">Parle\Parser</a></span> is not compatible with this lexer.
   </p>
  </div>


  <div class="section" id="parle-rlexer.synopsis">
   <h2 class="title">类摘要</h2>


   <div class="classsynopsis">
    <div class="ooclass"></div>


    <div class="classsynopsisinfo">
     <span class="ooclass">
      <span class="modifier">class</span> <strong class="classname">Parle\RLexer</strong>
     </span>
     {</div>

    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Constants */</div>
    <div class="fieldsynopsis">
     <span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.parle-rlexer.html#parle-rlexer.constants.flag-regex-icase"><var class="varname">ICASE</var></a></var><span class="initializer"> = 1</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.parle-rlexer.html#parle-rlexer.constants.flag-regex-dot-not-lf"><var class="varname">DOT_NOT_LF</var></a></var><span class="initializer"> = 2</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.parle-rlexer.html#parle-rlexer.constants.flag-regex-dot-not-cr-lf"><var class="varname">DOT_NOT_CRLF</var></a></var><span class="initializer"> = 4</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.parle-rlexer.html#parle-rlexer.constants.flag-regex-skip-ws"><var class="varname">SKIP_WS</var></a></var><span class="initializer"> = 8</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">const</span>
     <span class="type">int</span>
      <var class="fieldsynopsis_varname"><a href="class.parle-rlexer.html#parle-rlexer.constants.flag-regex-match-zero-len"><var class="varname">MATCH_ZERO_LEN</var></a></var><span class="initializer"> = 16</span>;</div>

    
    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 属性 */</div>
    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">bool</span>
      <var class="varname"><a href="class.parle-rlexer.html#parle-rlexer.props.bol">$<var class="varname">bol</var></a></var><span class="initializer"> = <strong><code>false</code></strong></span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">int</span>
      <var class="varname"><a href="class.parle-rlexer.html#parle-rlexer.props.flags">$<var class="varname">flags</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">int</span>
      <var class="varname"><a href="class.parle-rlexer.html#parle-rlexer.props.state">$<var class="varname">state</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">int</span>
      <var class="varname"><a href="class.parle-rlexer.html#parle-rlexer.props.marker">$<var class="varname">marker</var></a></var><span class="initializer"> = 0</span>;</div>

    <div class="fieldsynopsis"><span class="modifier">public</span>
     <span class="type">int</span>
      <var class="varname"><a href="class.parle-rlexer.html#parle-rlexer.props.cursor">$<var class="varname">cursor</var></a></var><span class="initializer"> = 0</span>;</div>


    <div class="classsynopsisinfo classsynopsisinfo_comment">/* 方法 */</div>
    <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.advance.html" class="methodname">advance</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.build.html" class="methodname">build</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.callout.html" class="methodname">callout</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$id</code></span>, <span class="methodparam"><span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span> <code class="parameter">$callback</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.consume.html" class="methodname">consume</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.dump.html" class="methodname">dump</a></span>(): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.gettoken.html" class="methodname">getToken</a></span>(): <span class="type"><a href="class.parle-token.html" class="type Parle\Token">Parle\Token</a></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.insertmacro.html" class="methodname">insertMacro</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$name</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$regex</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.push.html" class="methodname">push</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$regex</code></span>, <span class="methodparam"><span class="type">int</span> <code class="parameter">$id</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.push.html" class="methodname">push</a></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$state</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$regex</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$id</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$newState</code></span><br>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.push.html" class="methodname">push</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$state</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$regex</code></span>, <span class="methodparam"><span class="type">string</span> <code class="parameter">$newState</code></span>): <span class="type"><span class="type void">void</span></span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.pushstate.html" class="methodname">pushState</a></span>(<span class="methodparam"><span class="type">string</span> <code class="parameter">$state</code></span>): <span class="type">int</span></div>
<div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><a href="parle-rlexer.reset.html" class="methodname">reset</a></span>(<span class="methodparam"><span class="type">int</span> <code class="parameter">$pos</code></span>): <span class="type"><span class="type void">void</span></span></div>

   }</div>


  </div>
  

  <div class="section" id="parle-rlexer.constants">
   <h2 class="title">预定义常量</h2>
   <dl>

    
     <dt id="parle-rlexer.constants.flag-regex-icase"><strong><code>Parle\RLexer::ICASE</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="parle-rlexer.constants.flag-regex-dot-not-lf"><strong><code>Parle\RLexer::DOT_NOT_LF</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="parle-rlexer.constants.flag-regex-dot-not-cr-lf"><strong><code>Parle\RLexer::DOT_NOT_CRLF</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="parle-rlexer.constants.flag-regex-skip-ws"><strong><code>Parle\RLexer::SKIP_WS</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

    
     <dt id="parle-rlexer.constants.flag-regex-match-zero-len"><strong><code>Parle\RLexer::MATCH_ZERO_LEN</code></strong></dt>

     <dd>

      <p class="para"/>
     </dd>

    

   </dl>

  </div>



  <div class="section" id="parle-rlexer.props">
   <h2 class="title">属性</h2>
   <dl>
    
     <dt id="parle-rlexer.props.bol"><var class="varname">bol</var></dt>

     <dd>

      <p class="para">Start of input flag.</p>
     </dd>

    
    
     <dt id="parle-rlexer.props.flags"><var class="varname">flags</var></dt>

     <dd>

      <p class="para">Lexer flags.</p>
     </dd>

    
    
     <dt id="parle-rlexer.props.state"><var class="varname">state</var></dt>

     <dd>

      <p class="para">Current lexer state, readonly.</p>
     </dd>

    
    
     <dt id="parle-rlexer.props.marker"><var class="varname">marker</var></dt>

     <dd>

      <p class="para">Position of the latest token match, readonly.</p>
     </dd>

    
    
     <dt id="parle-rlexer.props.cursor"><var class="varname">cursor</var></dt>

     <dd>

      <p class="para">Current input offset, readonly.</p>
     </dd>

    
   </dl>

  </div>


 </div>

 
 







































































<h2>目录</h2><ul class="chunklist chunklist_reference"><li><a href="parle-rlexer.advance.html">Parle\RLexer::advance</a> — Process next lexer rule</li><li><a href="parle-rlexer.build.html">Parle\RLexer::build</a> — Finalize the lexer rule set</li><li><a href="parle-rlexer.callout.html">Parle\RLexer::callout</a> — Define token callback</li><li><a href="parle-rlexer.consume.html">Parle\RLexer::consume</a> — Pass the data for processing</li><li><a href="parle-rlexer.dump.html">Parle\RLexer::dump</a> — Dump the state machine</li><li><a href="parle-rlexer.gettoken.html">Parle\RLexer::getToken</a> — Retrieve the current token</li><li><a href="parle-rlexer.insertmacro.html">Parle\RLexer::insertMacro</a> — Insert regex macro</li><li><a href="parle-rlexer.push.html">Parle\RLexer::push</a> — Add a lexer rule</li><li><a href="parle-rlexer.pushstate.html">Parle\RLexer::pushState</a> — Push a new start state</li><li><a href="parle-rlexer.reset.html">Parle\RLexer::reset</a> — Reset lexer</li></ul>
</div>
</div></div></body></html>